home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / Pascal Demo Projects / Metrowerks Pascal 1.0d7 Demos / fDemoMP.p < prev    next >
Text File  |  1994-03-02  |  3KB  |  144 lines

  1. {FaceIt 2.2 Demonstration Program}
  2. {©FaceWare 1989-94.  All Rights Reserved.}
  3. {C1 - run program to see on-line comments}
  4. program fDemoMP;
  5.  
  6. {C2}
  7.     uses
  8.         FaceStorMP, FaceProcMP, ToolUtils, OSEvents;
  9.     var
  10.         i, mode: integer;
  11.         oldCount, newCount: longint;
  12.         keys: KeyMap;
  13.         fileName: Str255;
  14.  
  15. begin
  16.     with fRec do
  17.         begin
  18. {C3}
  19.             uName := 'fDemo.Rsrc';
  20. {C4}
  21.             FaceIt(nil, DoInit, 3, 0, 0, 0);
  22. {C5}
  23.             FaceIt(nil, NewWnd, 1010, 1, 0, 0);
  24.             FaceIt(nil, NewWnd, 1020, 1, 0, 0);
  25. {C6}
  26.             FaceIt(nil, NewWnd, 1030, 1, 0, 0);
  27. {C7}
  28.             FaceIt(nil, NewWnd, 1040, 2, 0, 0);
  29. {C8}
  30.             repeat
  31.                 FaceIt(nil, DoLoop, 0, 0, 0, 0);
  32. {C9}
  33.                 case uMenuID of
  34. {C10}
  35.                     101: 
  36.                         if (uMenuItem = 1) then
  37.                             begin
  38.                                 uString := concat('Demonstration of the use of FaceIt', chr(13), 'to support program-wide features.');
  39.                                 FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
  40.                             end;
  41. {C11}
  42.                     102: 
  43.                         if (uMenuItem = 6) then
  44.                             begin
  45.                                 FaceIt(nil, GetWVC, 1010, 0, 0, 0);
  46.                                 FaceIt(nil, SavWnd, 1010, 0, 0, 0);
  47.                                 FaceIt(nil, GetWVC, 1020, 0, 0, 0);
  48.                                 FaceIt(nil, SavWnd, 1020, 0, 0, 0);
  49.                                 FaceIt(nil, GetWVC, 1040, 0, 0, 0);
  50.                                 FaceIt(nil, SavWnd, 1040, 0, 0, 0);
  51.                             end;
  52. {C12}
  53.                     105, 106, 1030, 1040: 
  54.                         case uMenuItem of
  55.                             1: 
  56.                                 SysBeep(5);
  57.                             2: 
  58.                                 begin
  59.                                     SysBeep(5);
  60.                                     SysBeep(5);
  61.                                 end;
  62.                             3: 
  63.                                 begin
  64.                                     SysBeep(5);
  65.                                     SysBeep(5);
  66.                                     SysBeep(5);
  67.                                 end;
  68. {C13}
  69.                             4: 
  70.                                 begin
  71.                                     FaceIt(nil, GetCtl, 1030, 0, 1, 4);
  72.                                     FaceIt(nil, PopMen, 107, cRect.top - 9, cRect.left - 10, 0);
  73.                                 end;
  74. {C14}
  75.                             8: 
  76.                                 begin
  77. {C15}
  78.                                     FaceIt(nil, ShoAlt, 1010, 0, 1, 1);
  79.                                     mode := uResult;
  80.                                     oldCount := 0;
  81.                                     if (mode > 1) then
  82.                                         while true do
  83.                                             begin
  84. {C16}
  85.                                                 newCount := TickCount;
  86.                                                 if (newCount - oldCount > 180) then
  87.                                                     begin
  88.                                                         SysBeep(5);
  89.                                                         oldCount := newCount;
  90.                                                     end;
  91. {C17}
  92.                                                 if (mode = 2) then
  93.                                                     if GetNextEvent(-1, fEvent) then
  94.                                                         if (fEvent.what = 5) then
  95.                                                             leave
  96.                                                         else
  97.                                                             FaceIt(nil, DoEvnt, 0, 0, 0, 0);
  98. {C18}
  99.                                                 if (mode = 3) then
  100.                                                     begin
  101.                                                         GetKeys(keys);
  102.                                                         if BitTst(@keys, 61) and BitTst(@keys, 48) then
  103.                                                             begin
  104.                                                                 FlushEvents(62, 0);
  105.                                                                 leave;
  106.                                                             end;
  107.                                                     end;
  108.                                             end;
  109.                                 end;
  110.                             otherwise
  111.                         end;
  112. {C19}
  113.                     1100: 
  114.                         if (uMenuItem = 2) then
  115.                             begin
  116.                                 if (fActiveWnd = nil) then
  117.                                     uString := 'No Window'
  118.                                 else if (fActiveID <> 1200) then
  119.                                     uString := 'Non-ViewIt Window'
  120.                                 else if (fActiveResID = 1204) then
  121.                                     uString := 'Help Window'
  122.                                 else if (fActiveResID = 1010) then
  123.                                     uString := 'Editor Window'
  124.                                 else if (fActiveResID = 1020) then
  125.                                     uString := 'Clipboard Window'
  126.                                 else if (fActiveResID = 1030) then
  127.                                     uString := 'Beeps Window';
  128.                                 FaceIt(nil, SetItm2, 105, 10, 3, 0);
  129.                             end
  130. {C20}
  131.                         else if (uMenuItem = 512) then
  132.                             if (uString = 'TEXT') and (uResult = 1) then
  133.                                 begin
  134.                                     fileName := uName;
  135.                                     FaceIt(nil, GetCtl, 1010, 0, 1, 1);
  136.                                     uName := fileName;
  137.                                     FaceIt(cControl, 1551, 0, 1, 0, 0);    {OpnCTxt}
  138.                                 end;
  139.                     otherwise
  140.                 end;
  141.             until false;
  142.  
  143.         end;
  144. end.